package com.personal.site.utils;

import java.util.Random;

public class RandomUtil {

    public static final String allChar = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYX";

    public static final String allNumber = "0123456789";


    public static String randomNumber(int length){

        StringBuilder sb = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < length; i++) {
            sb.append(allNumber.charAt(random.nextInt(allNumber.length())));
        }
        return sb.toString();
    }


    public static String randomString(int length){
        StringBuilder sb = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < length; i++) {
            sb.append(allChar.charAt(random.nextInt(allChar.length())));
        }
        return sb.toString();
    }
}
